{	Problem: http://codeforces.ru/problemset/problem/43/C
 	Verdict: Accepted
}
var i,j,r,n:longint; a,b:array[1..10010] of longint; f:boolean;
begin
fillchar(b,sizeof(b),0);
read(n);
r:=0;
for i:=1 to n do read(a[i]);
for i:=1 to n-1 do begin
  f:=false;
  for j:=i+1 to n do
    if ((a[i]+a[j]) mod 3=0) and (b[i]=0) and (b[j]=0) then begin
      inc(r);
      b[i]:=1;
      b[j]:=1;
      f:=true;
      break;
    end;
  if f then continue;
end;
write(r);
end.